import router from './index'
import store from '../store'
router.beforeEach((to, from, next) => {
  const token = store.state.token
  // console.log(to)
  if (token) {
    if (to.path !== '/login') { next() } else { next(false) }
  } else {
    if (to.path !== '/login') { next('/login?from=' + to.path) } else { next() }
    // next('/login')
  }
})
